<?php
namespace controller;

use think\Request;
use think\Db;
use think\Response;
/**
 * 移动端数据接口通用控制器
 * Class BasicApi
 * @package controller
 */
class BasicAppApi{

    /**
     * 访问请求对象
     * @var Request
     */
    public $request;

    /**
     * 当前访问身份
     * @var string
     */
    public $token;

    /**
     * 基础接口
     * @param Request|null $request
     */
    public function __construct(Request $request = null){
        // 获取当前 Request 对象
        $this->request = is_null($request) ? Request::instance() : $request;

        $param = $this->request->param();

        $info = Db::name('AppUser')->where('token',$param['token'])->find();

        if(!$info){
            exit(json(['code' => 404,'msg'  => 'token失效，请从新登录',])->send());
        }
        //$param = $request->param();
    }


}
